package com.ainge.easystudy.timeoutcenter;

import com.google.gson.Gson;

import java.io.Serializable;

/**
 * 超时任务
 *
 * @author: Ainge
 * @Time: 2021/8/4 23:34
 */
public class TimeOutTask  implements Serializable{

    public static final Gson gson = new Gson();

    /**
     * 任务ID，一般为记录表的主键id
     */
    private String taskId;

    /**
     * 标识该任务
     *
     * @see TimeOutType
     */
    private int type;

    /**
     * 任务开始执行的时间戳(毫秒)
     */
    private double actionTime;

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public double getActionTime() {
        return actionTime;
    }

    public void setActionTime(double actionTime) {
        this.actionTime = actionTime;
    }

    public String toJsonStr() {
        // 应该需要过滤掉actionTime的，这里暂时不处理
        return gson.toJson(this);
    }

    @Override
    public String toString() {
        return "TimeOutTask{" +
                "taskId='" + taskId + '\'' +
                ", type=" + type +
                ", actionTime=" + actionTime +
                '}';
    }
}
